version 10.1
#delimit;
set more off;
  quietly log;
  local logon = r(status);
  if "`logon'" == "on" {; log close; };
log using bbdw2012jop-analyze, text replace;

/*	************************************************************************	*/
/*     	File Name:	bbdw2012jop-analyze.do						*/
/*     	Date:   	August 01, 2012							*/
/*      Author: 	Frederick J. Boehmke						*/
/*      Purpose:	Replication file for analysis of exposure to Indian nations 	*/
/*			with and without gaming compacts in California in 1998 and 2000	*/
/*			as in Boehmke, Branton, Dillingham, and Witmer (2012, JOP). 	*/
/*	Input File:	bbdw2012jop.dta							*/
/*      Output File:	bbdw2012jop-analyze.log,					*/
/* 			bbdw2012jop-analyze.gph 					*/
/*	Requires:	grinter.ado,							*/
/*			estout.ado							*/
/*	************************************************************************	*/


use bbdw2012jop, clear;

		/* Generate the exposure interaction term. */

  generat exposure_gam_nog0500 = gaming_exp_0500*nongam_exp_0500;

  
	/********************************************************************************/
	/* Run the model for Proposition 1 and calculate marginal effects graphs. 	*/
	/********************************************************************************/

	
reg Prop1_yes gaming_exp_0500 nongam_exp_0500 exposure_gam_nog0500 Rep_Pres per_urban_tract 
	med_age_tract college_tract inc_tract_1000 white_tract indian_tract crime 
	if pre2000==0 [aw=pop2000], cluster(fips);

	estimates store prop1;

  grinter gaming_exp_0500, const02(nongam_exp_0500) inter(exposure_gam_nog0500) kdensity yline(0) xtitle("") 
	b1title(Non-Gaming Exposure) ytitle("", axis(1)) kdoption(ytitle("", axis(2)) lpattern(shortdash) lcolor(gs8)) 
	nonote nomeantext title(Proposition 1A) name(gam1, replace) scheme(s1mono) ylabel(#5, grid) max(4) nodraw;
	
  grinter nongam_exp_0500, const02(gaming_exp_0500) inter(exposure_gam_nog0500) kdensity yline(0) xtitle("") 
	b1title(Gaming Exposure) ytitle("", axis(1)) kdoption(ytitle("", axis(2)) lpattern(shortdash) lcolor(gs8)) 
	nonote nomeantext title(Proposition 1A) name(non1, replace) scheme(s1mono) ylabel(#5, grid) nodraw;

	
	/********************************************************************************/
	/* Run the model for Proposition 29 and calculate marginal effects graphs. 	*/
	/********************************************************************************/


reg Prop29_yes gaming_exp_0500 nongam_exp_0500 exposure_gam_nog0500 Rep_Pres per_urban_tract 
	med_age_tract college_tract inc_tract_1000 white_tract indian_tract crime 
	if pre2000==0 [aw=pop2000], cluster(fips);

	estimates store prop29;

  grinter gaming_exp_0500, const02(nongam_exp_0500) inter(exposure_gam_nog0500) kdensity yline(0) xtitle("") 
	b1title(Non-Gaming Exposure) ytitle("", axis(1)) kdoption(ytitle("", axis(2)) lpattern(shortdash) lcolor(gs8)) 
	nonote nomeantext title(Proposition 29) name(gam29, replace) scheme(s1mono) ylabel(#5, grid) max(4) nodraw;
	
  grinter nongam_exp_0500, const02(gaming_exp_0500) inter(exposure_gam_nog0500) kdensity yline(0) xtitle("") 
	b1title(Gaming Exposure) ytitle("", axis(1)) kdoption(ytitle("", axis(2)) lpattern(shortdash) lcolor(gs8)) 
	nonote nomeantext title(Proposition 29) name(non29, replace) scheme(s1mono) ylabel(#5, grid) nodraw;

	
	/********************************************************************************/
	/* Run the model for Proposition 5 and calculate marginal effects graphs. 	*/
	/********************************************************************************/


reg Prop5_yes gaming_exp_0500 nongam_exp_0500 exposure_gam_nog0500 Rep_Pres per_urban_tract 
	med_age_tract college_tract inc_tract_1000 white_tract indian_tract crime 
	if pre2000==1 [aw=pop2000], cluster(fips);

	estimates store prop5;
  
  grinter gaming_exp_0500, const02(nongam_exp_0500) inter(exposure_gam_nog0500) kdensity yline(0) xtitle("") 
	b1title(Non-Gaming Exposure) ytitle("", axis(1)) kdoption(ytitle("", axis(2)) lpattern(shortdash) lcolor(gs8)) 
	nonote nomeantext title(Proposition 5) name(gam5, replace) scheme(s1mono) ylabel(#5, grid) max(4) nodraw;
	
  grinter nongam_exp_0500, const02(gaming_exp_0500) inter(exposure_gam_nog0500) kdensity yline(0) xtitle("") 
	b1title(Gaming Exposure) ytitle("", axis(1)) kdoption(ytitle("", axis(2)) lpattern(shortdash) lcolor(gs8)) 
	nonote nomeantext title(Proposition 5) name(non5, replace) scheme(s1mono) ylabel(#5, grid) nodraw;

	
	/****************************************************************/
	/* Combine the marginal effects graphs, first for gaming and 	*/
	/* nongaming, then combine those two into one complete graph. 	*/
	/****************************************************************/


graph combine non5 non1 non29, scheme(s1mono) rows(1) xsize(6) ysize(2) title(Marginal Effect of Non-Gaming Exposure) 
	ycommon xcommon imargin(small) name(non, replace) nodraw;
	
graph combine gam5 gam1 gam29, scheme(s1mono) rows(1) xsize(6) ysize(2) title(Marginal Effect of Gaming Exposure) 
	ycommon xcommon imargin(small) name(gam, replace) nodraw;

graph combine non gam, scheme(s1mono) rows(2) xsize(6) ysize(4) 
	ycommon xcommon imargin(small) name(full_pre2000_1, replace) 
	saving(bbdw2012jop-analyze, replace);

		
estout prop5 prop1 prop29,
	cells("b(fmt(2) star) se(par)")
	stats(N r2, fmt(0 2))
	modelwidth(6)
	starlevels(* 0.05 ** 0.01) legend
	label varwidth(30)
	varlabels(casino_exp_0500 "Casino Exposure" noncas_exp_0500 "Noncasino Exposure" 
	  exposure_cas_noc0500 "Exposure Interaction" _cons constant) 
	collabels(, none);

	
log close;
clear;
exit, STATA;
